#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Data::Dumper;
 
my %routerconfigs=();
 
$routerconfigs{'r0'}{"r0-r1-0"}{"A"}="FIRST";
$routerconfigs{'r0'}{"r0-r2-1"}{"A1"}="FIRST";
$routerconfigs{'r1'}{"rt0-r1-2"}{"B"}="THIRD";
$routerconfigs{'r1'}{"r1-r0-1"}{"C"}="SECOND";
$routerconfigs{'r0'}{"rt0-r0-1"}{"F"}="SECONDS";
$routerconfigs{'r0'}{"rt0-r0-2"}{"F"}="SECONDS";
$routerconfigs{'r0'}{"rt0-r0-3"}{"F"}="SECONDS";

$routerconfigs{'r1'}{"r1-r2-0"}{"D"}="FIRST";
$routerconfigs{'r2'}{"r0-r2-1"}{"E"}="THIRD";
$routerconfigs{'rt0'}{"rt0-r0-2"}{"F"}="SECOND";
$routerconfigs{'rt0'}{"rt0-r0-1"}{"F"}="SECONDS";
$routerconfigs{'rt0'}{"rt0-r0-2"}{"F"}="SECONDS";
$routerconfigs{'rt0'}{"rt0-r0-3"}{"F"}="SECONDS";

 
# foreach my $k1 ( sort keys %a ) {
  # # print $k1,"\n";
  # foreach my $k2 ( sort keys %{$a{$k1}} ) {
    # print $k2,"\n";
    # foreach my $k3 ( sort keys %{$a{$k1}{$k2}} ) {
      # # print "$k1\t$k2\t$k3\t$a{$k1}{$k2}{$k3}\n";
    # }
  # }
# }
sub getAllRouter
{
      my @allRouter;
      foreach my $k1 ( sort keys %routerconfigs ) {
            push(@allRouter,$k1);
      }
      return @allRouter;
}
sub getAllConnect
{
      my @allrouter;
      foreach my $k1 (getAllRouter()) {
          # print $k1,"\n";
          foreach my $k2 ( sort keys %{$routerconfigs{$k1}}) {
            push(@allrouter,$k2);
      }
    }
    return @allrouter;
}
sub 
{
      
}
print Dumper(\%routerconfigs);
print Dumper getAllRouter();
print Dumper getAllConnect();
print Dumper $routerconfigs{'r0'};